/********************************************************************************
 *      Copyright:  (C) 2023 Xie Mujie<1289180278@qq.com>
 *                  All rights reserved.
 *
 *       Filename:  conf_json.h
 *    Description:  This file 
 *
 *        Version:  1.0.0(2023年07月18日)
 *         Author:  Xie Mujie <1289180278@qq.com>
 *      ChangeLog:  1, Release initial version on "2023年07月18日 20时42分54秒"
 *                 
 ********************************************************************************/
#include "main.h"
 
#ifndef _CONF_JSON_H
#define _CONF_JSON_H

typedef struct mqtt_conf_s
{
	int         fd;
	char        log_path[128];
	char        hostname[128];
	int         port;
	char        clientid[128];
	char        username[128];
	char        passwd[128];
	char        subtopic[128];
	char        pubtopic[128];
	int         qos;
	int         keepalive;
	char        method[128];
	char        id[128];
	char        identifier[128];
	char        version[128];
}mqtt_conf_t;

#define CONFNAME "../configs/aly_conf.json"
#define HOSTNAME "iot-06z00c5ett0p84f.mqtt.iothub.aliyuncs.com"
#define PORT 1883
#define CLIENTID "ixfaPNFsSaJ.SHT20_mqtt|securemode=2,signmethod=hmacsha256,timestamp=1689696229861|"
#define USERNAME "SHT20_mqtt&ixfaPNFsSaJ"
#define PASSWD "2dca1c147389d8d37c01b7aea2501c086ed6c0b92f9093c0f8d1889bb3acfd4d"
#define LOG_PATH "./mqtt.log"
#define SUBTOPIC "/sys/ixfaPNFsSaJ/SHT20_mqtt/thing/service/property/set"
#define PUBTOPIC "/sys/ixfaPNFsSaJ/SHT20_mqtt/thing/event/property/post"
#define QOS 0
#define KEEPALIVE 60
#define METHOD "thing.event.property.set"
#define ID "id"
#define IDENTIFIER "data"
#define VERSION "1.0.0"

int set_conf_json(char *confname, char *hostname, int port, char *clientid, char *username, char *passwd);
int pari_conf_json(char *confname, mqtt_conf_t *conf_data);

#endif
